﻿@{
    ViewBag.Title = "辅助资料";
    Layout = "~/Views/Shared/_Form.cshtml";
}
<script>
    var keyValue = request('keyValue');
    var itemId = request('itemId');
    var parentId = request('parentId');
    $(function () {
        initControl();
    })
    //初始化控件
    function initControl() {
        //获取表单
        if (!!keyValue) {
            $.SetForm({
                url: "../../SystemManage/DataItemList/GetFormJson",
                param: { keyValue: keyValue },
                success: function (data) {
                    $("#form1").SetWebControls(data);
                }
            });
        } else {
            $("#F_ParentId").val(parentId);
            $("#F_ItemId").val(itemId);
        }
    }
    //保存表单
    function AcceptClick() {
        if (!$('#form1').Validform()) {
            return false;
        }
        var postData = $("#form1").GetWebControls(keyValue);
        if (postData["F_ParentId"] == "") {
            postData["F_ParentId"] = 0;
        }
        $.SaveForm({
            url: "../../SystemManage/DataItemList/SaveForm?keyValue=" + keyValue,
            param: postData,
            loading: "正在保存数据...",
            success: function () {
                if (top.DataItemList == undefined) {
                    $.currentIframe().$("#gridTable").resetSelection();
                    $.currentIframe().$("#gridTable").trigger("reloadGrid");
                } else {
                    top.DataItemList.$("#gridTable").resetSelection();
                    top.DataItemList.$("#gridTable").trigger("reloadGrid");
                }
            }
        })
    }
    //验证：项目值、项目名 不能重复
    function OverrideExistField(id, url) {
        $.ExistField(id, url, { itemId: itemId });
    }
</script>
<div style="margin-top: 20px; margin-right: 30px;">
    <input id="F_ParentId" type="hidden" />
    <input id="F_ItemId" type="hidden" />
    <table class="form">
        <tr>
            <td class="formTitle">项目名<font face="宋体">*</font></td>
            <td class="formValue">
                <input id="F_ItemName" type="text" onblur="OverrideExistField(this.id,'../../SystemManage/DataItemDetail/ExistItemName')" class="form-control" placeholder="请输入项目名" isvalid="yes" checkexpession="NotNull" />
            </td>
        </tr>
        <tr>
            <td class="formTitle">项目值<font face="宋体">*</font></td>
            <td class="formValue">
                <input id="F_ItemValue" type="text" type="text" onblur="OverrideExistField(this.id,'../../SystemManage/DataItemDetail/ExistItemValue')" class="form-control" placeholder="请输入项目值" isvalid="yes" checkexpession="NotNull" />
            </td>
        </tr>
        <tr>
            <th class="formTitle">排序<font face="宋体">*</font></th>
            <td class="formValue">
                <input id="F_SortCode" type="text" class="form-control" isvalid="yes" checkexpession="Num" />
            </td>
        </tr>
        <tr>
            <th class="formTitle" style="height: 37px;"></th>
            <td class="formValue">
                <div class="checkbox">
                    <label>
                        <input id="F_EnabledMark" type="checkbox" checked="checked" />
                        有效
                    </label>
                </div>
            </td>
        </tr>
        <tr>
            <th class="formTitle" valign="top" style="padding-top: 4px;">备注
            </th>
            <td class="formValue">
                <textarea id="F_Description" class="form-control" style="height: 70px;"></textarea>
            </td>
        </tr>
    </table>
</div>

